package com.example.lottery.service.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum ActivityPrizeEnum {
    /**
     * 奖品是否被抽中
     */
    INIT(1,"未抽中"),
    COMPLETE(2,"已抽中");

    /**
     * 状态代码
     */
    private final Integer code;
    /**
     * 状态信息
     */
    private final String msg;

    /**
     * 通过content找到对应的枚举实例 ，可以判断content是否合法
     * @param content
     * @return
     */
    public static ActivityPrizeEnum forName(String content){
        //枚举类.values获取所有枚举实例
        for(ActivityPrizeEnum activityPrizeEnum:ActivityPrizeEnum.values()){
            if(activityPrizeEnum.name().equalsIgnoreCase(content)){
                return activityPrizeEnum;
            }
        }
        return null;
    }
}
